wait_timeout = "60"
lte_cmd = [
    {
        "cmd": 'AT+CGMI',
        "match": 'AT\+CGMI\s{4}\+CGMI: "(?:.|\n)*"\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGMM',
        "match": 'AT\+CGMM\s{4}\+CGMM: "(?:.|\n)*"\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGMR',
        "match": 'AT\+CGMR\s{4}\+CGMR: "(?:.|\n)*"\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGMR=?',
        "match": 'AT\+CGMR=\?\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGSN',
        "match": 'AT\+CGSN\s{4}\d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGSN=?',
        "match": 'AT\+CGSN=\?\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CCID',
        "match": 'AT\+CCID\s{4}\w+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+ICCID',
        "match": 'AT\+ICCID\s{4}\+ICCID: \w+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CIMI',
        "match": 'AT\+CIMI\s{4}\d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'ATI',
        "match": 'ATI\s{4}AirM2M_\w*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+VER',
        "match": 'AT\+VER\s{4}AirM2M(?:.|\n)+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT^HVER',
        "match": 'AT\^HVER\s{4}\^HVER: (?:.|\n)+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT*I',
        "match": 'AT\*I\s{4}Manufacturer: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+WISN="1234567890"',
        "match": 'AT\+WISN="1234567890"\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+WISN?',
        "match": 'AT\+WISN\?\s{4}1234567890\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        'cmd': 'AT+CSCS?',
        'match': 'AT\+CSCS\?\s{4}\+CSCS: "\w+"\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CCLK?',
        "match": 'AT\+CCLK\?\s{4}\+CCLK: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CCLK=?',
        "match": 'AT\+CCLK=\?\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+SETUSB?',
        "match": 'AT\+SETUSB\?\s{4}mode: \d\s{2}Vid: \w{6}\s{2}Pid: \w{6}\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+SETUSB=?',
        "match": 'AT\+SETUSB=\?\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CPAS',
        "match": 'AT\+CPAS\s{4}\+CPAS: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CPAS=?',
        "match": 'AT\+CPAS=\?\s{4}\+CPAS: \([\d,]+\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CFUN?',
        "match": 'AT\+CFUN\?\s{4}\+CFUN: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CFUN=?',
        "match": 'AT\+CFUN=\?\s{4}\+CFUN: \([\d,]+\),\([\d\-,]+\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CPIN?',
        "match": 'AT\+CPIN\?\s{4}\+CPIN: READY\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CPIN=?',
        "match": 'AT\+CPIN=\?\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CLCK=?',
        "match": 'AT\+CLCK=\?\s{4}\+CLCK: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CPWD=?',
        "match": 'AT\+CPWD=\?\s{4}\+CPWD: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+SLEDS?',
        "match": 'AT\+SLEDS\?\s{4}\+SLEDS: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+SLEDS=?',
        "match": 'AT\+SLEDS=\?\s{4}\+SLEDS: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+IPR?',
        "match": 'AT\+IPR\?\s{4}\+IPR: \d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+IPR=?',
        "match": 'AT\+IPR=\?\s{4}\+IPR: (?:.|\n)+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+ICF?',
        "match": 'AT\+ICF\?\s{4}\+ICF: \d,\d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+ICF=?',
        "match": 'AT\+ICF=\?\s{4}\+ICF: \(\d\-\d\),\(\d\-\d\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'ATS4?',
        "match": 'ATS4\?\s{4}10\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+IFC?',
        "match": 'AT\+IFC\?\s{4}\+IFC: \d,\d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+IFC=?',
        "match": 'AT\+IFC=\?\s{4}\+IFC: \([\d,\-]+\),\([\d,\-]+\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CMUX?',
        "match": 'AT\+CMUX\?\s{4}\+CMUX: \d,\d,\d,\d+,\d+,\d,\d+,\d+,\d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CMUX=?',
        "match": 'AT\+CMUX=\?\s{4}\+CMUX:\(0\),\(0\),\(1\-7\),\(1\-255\),\(1\-255\),\(0\-100\),\(2\-255\),\(1\-255\),\(1\-7\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CSDT?',
        "match": 'AT\+CSDT\?\s{4}\+CSDT: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CSDT=?',
        "match": 'AT\+CSDT=\?\s{4}\+CSDT: \(0\-1\)\s{4}OK\s{2}',
    },
    # {
    #     "cmd": 'AT*SIMDETEC=?',
    #     "match": 'AT\*SIMDETEC=\?\s{4}\*SIMDETEC: \(1,2\)\s{4}OK\s{2}',
    # },
    # {
    #     "cmd": 'AT*SIMDETEC=1',
    #     "match": 'AT\*SIMDETEC=1\s{4}\*SIMDETEC: SIM\s{4}OK\s{2}',
    # },
    {
        "cmd": 'AT^CARDMODE?',
        "match": 'AT\^CARDMODE\?\s{4}\^CARDMODE: 2,1\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT^CARDMODE=?',
        "match": 'AT\^CARDMODE=\?\s{4}\^CARDMODE: \(0\-1\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT*EUICC?',
        "match": 'AT\*EUICC\?\s{4}\*EUICC: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CSCLK?',
        "match": 'AT\+CSCLK\?\s{4}\+CSCLK: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CSCLK=?',
        "match": 'AT\+CSCLK=\?\s{4}\+CSCLK: \(0-2\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+WAKETIM?',
        "match": 'AT\+WAKETIM\?\s{4}\+WAKETIM: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CFGRI?',
        "match": 'AT\+CFGRI\?\s{4}\+CFGRI: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+MIFIMAC=W,112233445566',
        "match": 'AT\+MIFIMAC=W,112233445566\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+MIFIMAC=R',
        "match": 'AT\+MIFIMAC=R\s{4}\+MIFIMAC: \w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CADC?',
        "match": 'AT\+CADC\?\s{4}\+CADC:\d,\d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CBC',
        "match": 'AT\+CBC\s{4}\+CBC: \d,\d+,\d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CBC=?',
        "match": 'AT\+CBC=\?\s{4}\+CBC: \(0\-2\),\(\d\-100\),\(voltage\)\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CNETLIGHT?',
        "match": 'AT\+CNETLIGHT\?\s{4}\+CNETLIGHT: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CSQ',
        "match": 'AT\+CSQ\s{4}\+CSQ: \d+,\d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CESQ',
        "match": 'AT\+CESQ\s{4}\+CESQ: \d+,\d+,\d+,\d+,\d+,\d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT*CSQ?',
        "match": 'AT\*CSQ\?\s{4}\*CSQ: \d\s{4}OK\s{2}',
    },
    {
        'cmd': 'AT+CREG=2;+CEREG=2;+CGREG=2',
        'match': 'AT\+CREG=2;\+CEREG=2;\+CGREG=2\s{4}OK\s{2}',
        'wait': b'OK',
        'timeout': wait_timeout
    },
    {
        "cmd": 'AT+CREG?;+CEREG?;+CGREG?',
        "match": 'AT\+CREG\?;\+CEREG\?;\+CGREG\?\s{4}\+CREG: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        'cmd': 'AT+CREG=0;+CEREG=0;+CGREG=0',
        'match': 'AT\+CREG=0;\+CEREG=0;\+CGREG=0\s{4}OK\s{2}',
        'wait': b'OK',
        'timeout': wait_timeout
    },
    {
        "cmd": 'AT^SYSCONFIG?',
        "match": 'AT\^SYSCONFIG\?\s{4}\^SYSCONFIG: \d+,\d+,\d+,\d+\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGCONTRDP=5',
        "match": '.*',
    },
    {
        "cmd": 'AT+COPS?',
        "match": 'AT\+COPS\?\s{4}\+COPS: \d,\d,"\d+",\d\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+CTZU?',
        "match": 'AT\+CTZU\?\s{4}\+CTZU: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CTZR?',
        "match": 'AT\+CTZR\?\s{4}\+CTZR: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT*BAND?',
        "match": 'AT\*BAND\?\s{4}\*BAND:\d+,\d+,\d+,\d+,\d+,\d,\d,\d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT*BANDIND?',
        "match": 'AT\*BANDIND\?\s{4}\*BANDIND: \d, \d+, \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT^CACAP?',
        "match": 'AT\^CACAP\?\s{4}\+CACAP:\d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT^SYSINFO',
        "match": 'AT\^SYSINFO\s{4}\^SYSINFO: \d,\d,\d,\d+,\d,\d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+SAPBR=3,1,"Contype","GPRS"',
        "match": 'AT\+SAPBR=3,1,"Contype","GPRS"\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+SAPBR=3,1,"APN",""',
        "match": 'AT\+SAPBR=3,1,"APN",""\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+SAPBR=1,1',
        "match": 'AT\+SAPBR=1,1\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+SAPBR=2,1',
        "match": 'AT\+SAPBR=2,1\s{4}\+SAPBR: \d,\d,"[\.\d]+"\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CIPGSMLOC=1,1',
        "match": 'AT\+CIPGSMLOC=1,1\s{4}\+CIPGSMLOC: \d,[\d\.]+,[\d\.]+,[\d/]+,[\d:]+\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+CIPGSMLOC=2,1',
        "match": 'AT\+CIPGSMLOC=2,1\s{4}\+CIPGSMLOC: \d,[\d/]+,[\d:]+\s{4}OK\s{2}',
        "wait": b'OK',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+CGATT?',
        "match": 'AT\+CGATT\?\s{4}\+CGATT: \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGDCONT?',
        "match": 'AT\+CGDCONT\?\s{4}\+CGDCONT: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CGPADDR',
        "match": 'AT\+CGPADDR\s{4}\+CGPADDR: (?:.|\n)*\s{4}OK\s{2}',
    },
    {
        'cmd': 'AT+CGACT?',
        'match': 'AT\+CGACT\?\s{4}\+CGACT: \d, \d\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CNTPCID=1',
        "match": 'AT\+CNTPCID=1\s{4}OK\s{2}',
    },
    {
        "cmd": 'AT+CNTP',
        "match": 'AT\+CNTP\s{4}OK\s{4}\+CNTP: 1\s{2}',
        "wait": b'+CNTP: 1\r\n',
        "timeout": wait_timeout
    },
    {
        "cmd": 'AT+SAPBR=0,1',
        "match": 'AT\+SAPBR=0,1\s{4}OK\s{2}',
    },
]
